<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>后台登录</title>
		<script>
			function show(){
				var _uname=uname.value;
				var _upwd=upwd.value;
				var xhr=new XMLHttpRequest();
				xhr.onreadystatechange=function(){
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						if(r==1){
							alert("登陆成功");
							location.href='http://127.0.0.1:8080/product_list.html'
						}else{
							alert("请输入正确的后台账号密码");
							}
					}
				}
				xhr.open("POST","product/product_login",true);
				var formdata=`uname=${_uname}&upwd=${_upwd}`;
				xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xhr.send(formdata);
			}
		</script>
	</head>
	<body>
		用户名：<br>
		<input type="text" id="uname"><br>
		密码：<br>
		<input type="text" id="upwd"><br>
		<button onclick="show()">登录</button>
	</body>
</html>
